Skip to content

refactor: use slices.Contains to simplify code#6069

Merged
boojack merged 1 commit into
usememos:mainfrom
weifanglab:main
Jul 7, 2026
Merged

refactor: use slices.Contains to simplify code#6069
boojack merged 1 commit into
usememos:mainfrom
weifanglab:main

Conversation

@weifanglab

Copy link
Copy Markdown
Contributor

There is a new function added in the go1.21 standard library, which can make the code more concise and easy to read.

Signed-off-by: weifanglab <weifanglab@outlook.com>
@weifanglab weifanglab requested a review from a team as a code owner July 6, 2026 16:21
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dbaadfa8-5802-489f-b111-30b629902923

📥 Commits

Reviewing files that changed from the base of the PR and between d1cef7a and b4f872b.

📒 Files selected for processing (1)
  • internal/scheduler/parser.go

📝 Walkthrough

Walkthrough

The listMatcher.matches function in internal/scheduler/parser.go was refactored to use slices.Contains instead of a manual loop over m.values, requiring the addition of the slices package import. No behavioral change to cron parsing or scheduling logic.

Changes

Parser refactor

Layer / File(s) Summary
Use slices.Contains for value lookup
internal/scheduler/parser.go
Imports slices and replaces the manual loop in listMatcher.matches with a slices.Contains(m.values, value) call.

Related PRs: None identified.

Suggested labels: refactor, low-risk

Suggested reviewers: None specified.

Poem:
A rabbit hopped through cron-lined code,
Found a loop upon the road,
Swapped it out for slices.Contains,
Tidy, quick, no more remains,
Hop hop—cleaner paths bestowed. 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: replacing the manual search with slices.Contains.
Description check ✅ Passed The description is on-topic and explains the Go 1.21 slices.Contains addition used by the change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@boojack boojack merged commit 9fae524 into usememos:main Jul 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants